package com.aos;

import java.io.PrintWriter;

public class Communication
{
	//**********Mustafa*************
	//**************Type of message*********
	public static String m_msg = "M"; // notification message
	public static String p_msg = "P"; // parent message
	public static String a_msg = "A"; // already has a message
	public static String t_msg = "T"; // termination message
	public static String h_req_msg = "H_REQ"; //height message request
	public static String h_rpl_msg = "H_RPL"; //height message reply
	public static String priv_msg = "PRIV"; //Privilege message
	public static String priv_rpl_msg = "PRIV_RPL"; //privilege reply message
	//***************************************
	
	public static void sendMessage(PrintWriter sender, String msgType, String msg, String receiver)
	{
		//System.out.println(msgType + "::" + msg + "-->" + receiver);
		//System.out.println(msgType + " message sending from Node " + msg + " to Node "+ receiver);
		sender.flush();
		
		sender.println(msgType + "~"+ msg);
		//System.out.println("Message sent");
	}
}
